<template>
<!-- 单独封装HomeSwiper组件 使得home.vue代码不会过于复杂 -->
<swiper>
    <!-- v-for需要绑定：key -->
    <swiper-item v-for="item in banners" :key="item.id">
        <!-- 链接绑定需要加 ： -->
        <a :href="item.link">
            <img :src="item.image" alt="">
        </a>
    </swiper-item>
</swiper>
</template>

<script>
import {Swiper, SwiperItem} from 'components/common/swiper'

export default {
    name: 'HomeSwiper',
    //需要从父组件接收banners
    props: {
        banners: {
            type: Array,
            default() {
                return []
            }
        }
    },
    components: {
        Swiper,
        SwiperItem
    }
}
</script>

<style>

</style>